<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ext4yii xmlns:ext="http://www.w3.org/1999/xhtml" xmlns:prop="http://www.w3.org/1999/xhtml"/>
<ext:TreePanel title="Navigation" width="200" autoscroll="true">
    <prop:Root>
        <ext:AsyncTreeNode text="Index" iconcls="IconWorld" id="root" expanded="true"/>
    </prop:Root>
    <prop:Loader>
        <ext:TreeLoader url="<?php echo $this->createUrl("invoice/gettreelisting"); ?>" preloadchildren="true"/>
    </prop:Loader>
    <prop:Actions>
        <ext:ClientAction onevent="click">
            <prop:Handler>
                <script>
                    function(node)
                    {
                        var loadMask = new Ext.LoadMask(Ext.getBody(),{
                            msg:'Loading ' + node.attributes.LastName + ', Please Wait...'
                        });
                        loadMask.show();
                        customerStore.load({
                            loadMask:loadMask,
                            params:{
                                id:node.attributes.CustomerId
                            },
                            callback:function(record,options)
                            {
                                options.loadMask.hide();
                                customerEditorForm.setTitle("Details of " + record[0].data.LastName);
                                customerEditorForm.getForm().setValues(record[0].data);
                                invoiceStore.load({
                                    params:{
                                        id:node.attributes.CustomerId
                                    },
                                    callback:function()
                                    {
                                        invoiceLineStore.load({
                                            params:{
                                                id:-1
                                            }
                                        });

                                    }
                                });
                            }
                        });
                    }
                </script>
            </prop:Handler>
        </ext:ClientAction>
    </prop:Actions>
</ext:TreePanel>